import React from "react";
import {Row, Col} from "antd";
import "../../../../css/mobile/newslist.less";
import ReactSwipe from 'react-swipe';
export default class Newslist extends React.Component{

    constructor(){
        super();
        this.state={
            newslist:[]
        }
    }

    componentDidMount(event){
        var result=fetch("http://www.wwtliu.com/sxtstu/news/juhenews.php?type="+this.props.data+"&count=10",{
            method:"get"
        }).then(rel=>{
            return rel.json()
        }).then(json=>{
            this.setState({
                newslist:json
            })
            console.log(this.state.newslist)
        })
    }

    render(){
        return(
            <div>
                <Row>
                    <Col span={2}></Col>
                    <Col span={20}>
                    
                        <ul className="mobile_newslist">
                            {
                                this.state.newslist.map((item,index)=>{
                                    return (
                                        <li key={index}>
                                            <img src={item.thumbnail_pic_s}/>
                                            <div>
                                                <p><a href={item.url}>{item.title}</a> </p>
                                                <p>{item.date} </p>
                                            </div>
                                            
                                        </li>
                                    )
                                })
                            }
                        </ul>
                    </Col>
                    <Col span={2}></Col>
                </Row>
                

            </div>
        )
    }
}